//1.0引入Vue的核心包
import Vue from "vue"; //表示从nodemols中导入vue的包，并命名为Vue（不用选择路径）

//2.0引入根组件
import App from "./app.vue";//要用相对路径

//3.0引入路由的包
import VueRouter from "vue-router";
//3.1 必须将包绑定到Vue上
Vue.use(VueRouter); //这里不可省略

//4.0引入对应的路由组件
import home from "./components/home.vue";
import shopcar from "./components/shopcar/car.vue"; //这里的home和newslist是随意取的
import newslist from './components/news/newslist.vue';
import newsinfo from './components/news/newsinfo.vue';
import photolist from './components/photo/photolist.vue';
import photoinfo from './components/photo/photoinfo.vue';
import goodslist from './components/goods/goodslist.vue';
import goodsinfo from './components/goods/goodsinfo.vue';
import goodsdesc from './components/goods/goodsdesc.vue';
import goodscomment from './components/goods/goodscomment.vue';
import car from './components/shopcar/car.vue';
//5.0准备路由
var rot = new VueRouter({
    linkActiveClass: 'mui-active',//改变路由激活时的class名称
    routes: [
        { path: "/", redirect: "/Home" }, //设置默认指向
        { path: "/Home", component: home }, //上边是什么，这里就是什么，要一致
        { path: "/shopcar", component: shopcar },    //购物车
        { path: "/news/newslist", component: newslist },     //新闻资讯页面
        { path: "/news/newsinfo/:id", component: newsinfo },  //新闻详情页面
        { path: "/photo/photolist", component: photolist },  //新闻详情页面
        { path: "/photo/photoinfo/:id", component: photoinfo },  //新闻详情页面
        { path: "/goods/goodslist/", component: goodslist },  //新闻详情页面
        {path:'/goods/goodsinfo/:id',component:goodsinfo},
		{path:'/goods/goodsdesc/:id',component:goodsdesc},
		{path:'/goods/goodscomment/:id',component:goodscomment},
		{path:'/shopcar/car',component:car}
    ]
});

//6.0 注册mint-ui
//导入mint-ui的css文件
import 'mint-ui/lib/style.min.css';
//导入mint-ui组件对象
import mintui from 'mint-ui';
//在Vue中使用mintui
Vue.use(mintui);

//7.0注册mui的css样式
import '../statics/mui/css/mui.css';

//8.0导入一个当前系统的全局基本样式
import '../statics/css/site.css';

//9.0将vue-resource在vue中绑定，自动在bue对象实例上注入一个$http对象就可以使用ajax方法了
import vueResource from 'vue-resource';
Vue.use(vueResource);

//10.0定一个全局过滤器实现日期的的格式化
import moment from 'moment';
Vue.filter('datefmt', function (input, fmtstring) {
    //使用momentjs这个日期格式化类库实现日期格式化功能
    return moment(input).format(fmtstring);
})

//11.0 缩略图
import vuePicturePreview from 'vue-picture-preview'
Vue.use(vuePicturePreview);

//12.0实例化Vue对象，进行页面渲染
new Vue({
    el: "#app",
    router: rot,
    render: c => c(App)// 这里是es6中的箭头函数，等同于(function(c){return App})();
})
